<?php
$this->render('include/sortLink.phtml');
echo $this->render('picture/topic/_tab.phtml');
if(!function_exists('__sortLink')) {
	function __sortLink() {}
}
?>
<form action="" method="post">
<div class="body">
	<table class="list">
		<tr>
			<th class="id"></th>
			<th class="narrow sort" title="<?php echo $this->language('Display Order');?>"><?php echo __sortLink('display_order', 'D');?></th>
			<th><?php echo $this->language('INFORMATION');?></th>
			<th class="narrow sort" title="<?php echo $this->language('Special Total Count');?>"><?php echo __sortLink('special', 'SPECIAL');?></th>
			<th class="time sort"><?php echo __sortLink('date', 'MODIFIED');?></th>
			<th class="narrow"></th>
		</tr>
		<?php foreach($this->list AS $key => $row) { ?>
		<tr>
			<td class="icon"><a href="<?php echo $row->getCover()->getLarge(false);?>" target="_blank"><img src="<?php echo $row->getCover()->getThumb(false);?>" /></a></td>
			<td class="key center">
				<?php
					if(!$row->getIsActive()) {
						echo '<em class="red">Invalid</em>';
					} else {
						echo $this->form()->text('display_order[' . $row->getId() . ']', $row->getDisplayOrder(), array('size' => '4', 'maxlength' => '8'));
						echo $this->form()->hidden('_display_order[' . $row->getId() . ']', $row->getDisplayOrder());
					}
				?>
				<strong style="display:block;padding:4px 0;"><?php echo $row->getName();?></strong>
			</td>
			<td<?php if(!$row->getIsActive()) {echo ' class="gray"';}?>>
				<h3 class="title"><a href="<?php echo $this->url('topic/index', array('name' => $row->getName()))->assemble($row->getLang());?>"><?php echo $this->escape($row->getTitle());?></a></h3>
				<p class="tags"><span>&nbsp;</span></p>
				<p class="tags"><span>&nbsp;</span></p>
				<p class="toolbar">
					<a href="<?php echo $this->url('picture/topic/edit', array('id' => $row->getId()));?>"><?php echo $this->language('Edit');?>»</a>
					<a href="<?php echo $this->url('picture/topic/special', array('id' => $row->getId()));?>"><?php echo $this->language('Special');?>(<?php echo $row->getStotal();?>)»</a>
					<a href="<?php echo $this->url('picture/topic/delete', array('id' => $row->getId()));?>"><?php echo $this->language('Delete');?>»</a>
				</p>
			</td>
			<td class="center<?php if(!$row->getStotal()) echo ' gray';?>"><h1><a href="<?php echo $this->url('picture/topic/special', array('id' => $row->getId()));?>"><?php echo $row->getStotal();?></a></h1></td>
			<td class="time"><?php echo $this->date($row->getLastmodified());?></td>
			<td></td>
		</tr>
		<?php } ?>
		<?php if(count($this->list) <= 0) {?>
		<tr>
			<td colspan="6" class="nohover">
				<div class="msg">
					<div class="common error" style="border:0;background:#fff;">
						<i class="icon"></i>
						<h4>STOP</h4>
						<div class="msg-bd">
							No Topic found. 
							<a href="<?php echo $this->url('picture/topic/addnew');?>"><?php echo $this->language('Create');?>..</a>
						</div>
					</div>
				</div>
			</td>
		</tr>
		<?php } ?>
	</table>
</div>
<div class="body">
	<div style="float:right;margin-bottom:5px;">
		<button type="reset" value="reset" onclick="return confirm('<?php echo $this->language('Reset all values you changed');?>?');"><?php echo $this->language('Reset');?></button>
		<button type="submit" value="submit" style="margin-right:0;" onclick="return confirm('<?php echo $this->language('Are you sure to Save all changes');?>?');"><?php echo $this->language('Save Changes');?></button>
	</div>
	<?php echo $this->paginator($this->list)->render();?>
</div>
</form>
